package com.laputacastle.dr.mapper;

import com.laputacastle.dr.model.DrContentImgs;
import org.apache.ibatis.jdbc.SQL;

public class DrContentImgsSqlProvider {

    public String insertSelective(DrContentImgs record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("t_dr_content_imgs");
        
        if (record.getCId() != null) {
            sql.VALUES("c_id", "#{cId,jdbcType=VARCHAR}");
        }
        
        if (record.getCDemorecordId() != null) {
            sql.VALUES("c_demorecord_id", "#{cDemorecordId,jdbcType=VARCHAR}");
        }
        
        if (record.getCImgName() != null) {
            sql.VALUES("c_img_name", "#{cImgName,jdbcType=VARCHAR}");
        }
        
        if (record.getDtCreatTime() != null) {
            sql.VALUES("dt_creat_time", "#{dtCreatTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getDtUpdateTime() != null) {
            sql.VALUES("dt_update_time", "#{dtUpdateTime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(DrContentImgs record) {
        SQL sql = new SQL();
        sql.UPDATE("t_dr_content_imgs");
        
        if (record.getCDemorecordId() != null) {
            sql.SET("c_demorecord_id = #{cDemorecordId,jdbcType=VARCHAR}");
        }
        
        if (record.getCImgName() != null) {
            sql.SET("c_img_name = #{cImgName,jdbcType=VARCHAR}");
        }
        
        if (record.getDtCreatTime() != null) {
            sql.SET("dt_creat_time = #{dtCreatTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getDtUpdateTime() != null) {
            sql.SET("dt_update_time = #{dtUpdateTime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("c_id = #{cId,jdbcType=VARCHAR}");
        
        return sql.toString();
    }
}